
<?php
header('Content-type:text/html;charset=utf-8');
date_default_timezone_set('PRC');


if(!empty($_POST['msgcon']) && !empty($_POST['user'])){
	// 判断是否未填写
	$_POST['user'] =empty($_POST['user'])? '未填写':$_POST['user'];
	$_POST['msgcon'] =empty($_POST['msgcon'])? '未填写':$_POST['msgcon'];
	$_POST['qq'] =empty($_POST['qq'])? '未填写':$_POST['qq'];
	$_POST['email'] =empty($_POST['email'])? '未填写':$_POST['email'];
	$_POST['addess'] =empty($_POST['addess'])? '未填写':$_POST['addess'];
	$_POST['sign'] =empty($_POST['sign'])? '未填写':$_POST['sign'];

	$date= include './mdb.php';
	$date[]=$_POST;
	$phpCode =var_export($date,true);
	file_put_contents('./mdb.php',"<?php \r\n return " .$phpCode ."\r\n?>");
$js=<<<js
<div id="sue" style='display:block;'><div class="alert">提示信息<br />添加成功！2秒后跳转首页若无响应请<a href='liuyanben.php' >点此返回</a></div></div>
js;
echo $js;
 echo "<script>setTimeout(function(){window.location.href='liuyanben.php'},2000)</script>";
}
$date= include './mdb.php';
include 'getWeather.php';
// var_dump($date);
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>发布留言信息</title>
	<link rel="stylesheet" type="text/css" href="css/post.css" />
	<script type="text/javascript" src='js/jquery-1.7.2.min.js'></script>
	<script type="text/javascript">
	$(function(){
$('.bgchose ul li').click(function() {
	var i=$(this).index();
	$('#main').css('background','url(images/userico/bg'+i+'.jpg) no-repeat');
	$(':radio[name="bgchose"]').eq(i).attr("checked",true);
	$('#style').val('style'+i+'css');
});	
$('.userpicchose ul li').click(function() {
	var i=$(this).index();
	$(':radio[name="userpicchose"]').eq(i).attr("checked",true);
});
// 替换天气文字
$today = $('#weather').val();
   re=new RegExp("白天：");
   re2=new RegExp("夜间：");
$today=$today.replace(re,'');
$today=$today.replace(re2,'~');
$('#weather').val($today);
// alert($('#weather').val());







	})
	</script>
</head>
<body>

	<div id="main">
	<form action="" method="post">
	         <!--  left  content -->
	          <div id="left">
	            <!-- 用户图像 选择 -->
	            <ul>
	            	
	         	 <li class="tit titbg">选择图像</li>
	            <div class="userpicchose">	            
	            <ul>
	 				<li class="radio">
	 				<img src="images/userico/1.jpg" height="220" width="200" alt="">
	 				<p><input type="radio" name="userpicchose" checked="checked" value="1.jpg" />图像1</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/2.jpg" alt="">
	 				<p><input type="radio" name="userpicchose" value="2.jpg" />图像2</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/3.jpg" alt="">
	 				<p><input type="radio" name="userpicchose" value="3.jpg" />图像3</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/4.jpg" alt="">
	 				<p><input type="radio" name="userpicchose" value="4.jpg" />图像4</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/5.jpg" alt="">
	 				<p><input type="radio" name="userpicchose"  value="5.jpg"  />图像5</p>
	 				</li>




	             </ul>
	            </div>
	            <!-- 背景选择 -->
	             <li class="tit titbg">选择背景</li>
	            <div class="bgchose">

	            	<ul>
	            		<li class="radio">
	            		<img src="images/userico/bgico1.jpg" alt="">
	            		<p><input type="radio" name="bgchose"  checked="checked"  value="bg0.jpg" />背景图片1</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico2.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg1.jpg" />背景图片2</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico3.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg2.jpg" />背景图片3</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico4.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg3.jpg" />背景图片4</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico5.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg4.jpg" />背景图片4</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico6.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg5.jpg" />背景图片4</p>
	            		</li>

	            		
	            	 </ul>
	            </div>

	            <!-- 用户信息 -->
	            <div class="userinfo">
	              <ul>
	                <li class="tit">昵称：</li><li><input type="text" name="user" value="" /></li>
	                 <li  class="tit">QQ：</li><li><input type="text" name="qq" value="" /></li>
	                  <li  class="tit">邮箱：</li><li><input type="text" name="email" value="" /></li>
	                  <li  class="tit">地址：</li><li><input type="text" name="addess" value="" /></li>
	                 
	              </ul>
	            </div>
	               </ul>
	          </div>
	         <!-- left content end -->
	      
	        <div class="preview-content right toc">
	        <!-- right content -->
	          
	        <div id="right">
	          <!-- 留言信息 -->
	          <div class="message">
	            <ul>
	                <li  class="tit titbg">留言信息：</li>
	              <li class="msgcon">
	              <textarea name="msgcon" id="" cols="30" rows="10" ></textarea>
	              </li>
	                <li  class="tit titbg">个性签名：</li>
	              <li class="sign">
	                 <textarea name="sign" id="" cols="30" rows="10"></textarea>
	              </li>
	            </ul>
	          </div>
				<input type="hidden" name="time" value="<?php echo date('y/m/d H:i:s'); ?>" />
				<input type="hidden" name="weather" id="weather" value="<?php echo $today ?>" />
				<input type="hidden" name="style" id="style" value="style1.css" />
	          <input type="submit"  id="btn" value="提交" />
	        </div>
	        <!-- right content  end-->    
	        
	        </div> 
	       </form> 
</div>
</body>
</html>